@include('admin/_include/header')
<style>
    .top-panel {
        border: 1px solid #eceff9;
        border-radius: 5px;
        text-align: center;
    }
    .top-panel > .layui-card-body{
        height: 60px;
    }
    .top-panel-number{
        line-height:60px;
        font-size: 30px;
        border-right:1px solid #eceff9;
    }
    .top-panel-tips{
        line-height:30px;
        font-size: 12px
    }
    .layui-elem-quote p{
        line-height: 38px;
    }
</style>
<div class="layuimini-main">

    <div class="layui-row layui-col-space15">
        <div class="layui-col-xs12 layui-col-md3">

            <div class="layui-card top-panel">
                <div class="layui-card-header">用户数据</div>
                <div class="layui-card-body">
                    <div class="layui-row layui-col-space5">
                        <div class="layui-col-xs9 layui-col-md9 top-panel-number">
                            {{$totalUser}}
                        </div>
                        <div class="layui-col-xs3 layui-col-md3 top-panel-tips">
                            昨日增长 <a style="color: #1aa094">▲{{$yesterdayUser}}</a><br>
                            近一周 <a style="color: #1aa094">▲{{$weekUser}}</a>
                        </div>
                    </div>
                </div>
            </div>

        </div>
        <div class="layui-col-xs12 layui-col-md3">

            <div class="layui-card top-panel">
                <div class="layui-card-header">订单总金额（元）</div>
                <div class="layui-card-body">
                    <div class="layui-row layui-col-space5">
                        <div class="layui-col-xs9 layui-col-md9 top-panel-number">
                            {{$totalAmount}}
                        </div>
                        <div class="layui-col-xs3 layui-col-md3 top-panel-tips">
                            昨日增长 <a style="color: #1aa094">▲{{$yesterdayAmount}}</a><br>
                            近一周 <a style="color: #1aa094">▲{{$weekAmount}}</a>
{{--                            比昨天 <a style="color: #1aa094">▲0.12</a><br>--}}
{{--                            比七日 <a style="color: #bd3004">▼0.06</a>--}}
                        </div>
                    </div>
                </div>
            </div>

        </div>
        <div class="layui-col-xs12 layui-col-md3">

            <div class="layui-card top-panel">
                <div class="layui-card-header">商品总量</div>
                <div class="layui-card-body">
                    <div class="layui-row layui-col-space5">
                        <div class="layui-col-xs9 layui-col-md9 top-panel-number">
                            {{$goods}}
                        </div>
{{--                        <div class="layui-col-xs3 layui-col-md3 top-panel-tips">--}}
{{--                            比昨天 <a style="color: #1aa094">▲0.12</a><br>--}}
{{--                            比七日 <a style="color: #bd3004">▼0.06</a>--}}
{{--                        </div>--}}
                    </div>
                </div>
            </div>

        </div>
        <div class="layui-col-xs12 layui-col-md3">

            <div class="layui-card top-panel">
                <div class="layui-card-header">订单总数</div>
                <div class="layui-card-body">
                    <div class="layui-row layui-col-space5">
                        <div class="layui-col-xs9 layui-col-md9 top-panel-number">
                            {{$order}}
                        </div>
{{--                        <div class="layui-col-xs3 layui-col-md3 top-panel-tips">--}}
{{--                            比昨天 <a style="color: #1aa094">▲0.12</a><br>--}}
{{--                            比七日 <a style="color: #bd3004">▼0.06</a>--}}
{{--                        </div>--}}
                    </div>
                </div>
            </div>

        </div>
    </div>

    <div class="layui-row layui-col-space15">
        <div class="layui-col-xs12 layui-col-md9">
            <div id="echarts-records" style="min-height:400px;padding: 10px;border-radius:5px;border: 1px solid #eceff9"></div>
        </div>
        <div class="layui-col-xs12 layui-col-md3">
            <div id="echarts-pies" style="min-height:400px;padding: 10px;border-radius: 5px; border: 1px solid #eceff9"></div>
        </div>
    </div>


    <div class="layui-box" >
        <div class="layui-row layui-col-space10">
            <div class="layui-col-md12" >
                <blockquote class="layui-elem-quote main_btn" style="background: #fff">
                    <p>本商城基于 <a href="https://laravel.com/" style="color: #00a1f1; text-decoration: underline" target="_blank">laravel 8.54</a>
                        以及 <a href="https://www.layui.com/" style="text-decoration: underline;color: #00a1f1">layui</a> 相关组件进行实现。</p>
                    <p>技术交流QQ群（172860097）：<a target="_blank" href="https://jq.qq.com/?_wv=1027&k=tPMik56W"><img border="0" src="//pub.idqqimg.com/wpa/images/group.png" alt="layuimini" title="layuimini"></a>（加群请备注来源：如gitee、官网等）。</p>
                    <p>喜欢本套商城的可以给我的Gitee加个Star支持一下，非常感谢。</p>
                    <p>Gitee地址：
                        <a href="https://gitee.com/voyagel_lzl/zh_shop" target="_blank">
                            <img src="https://gitee.com/voyagel_lzl/zh_shop/badge/star.svg?theme=dark" alt="star">
                        </a>
                        <a href="https://gitee.com/voyagel_lzl/zh_shop" target="_blank">
                            <img src="https://gitee.com/voyagel_lzl/zh_shop/badge/fork.svg?theme=dark" alt="fork">
                        </a>
                    </p>
                    <p>
                        Copyright © 2021 qq：<span style="color: blue">1552519081</span>  All rights reserved.
                    </p>
                </blockquote>
            </div>
        </div>
    </div>
</div>
<script>
    layui.config({
        base: "/plugin/layuiadmin/" //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'layer', 'console', 'echarts', 'echartsTheme'],function () {

        var $ = layui.jquery,
            layer = layui.layer,
            echarts = layui.echarts;

        /**
         * 报表功能
         */
        var echartsRecords = echarts.init(document.getElementById('echarts-records'), 'walden');

        var optionRecords = {
            title: {
                text: '没想好放啥'
            },
            backgroundColor:"#fff",
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'cross',
                    label: {
                        backgroundColor: '#6a7985'
                    }
                }
            },
            legend: {
                data: ['邮件营销', '联盟广告', '视频广告', '直接访问', '搜索引擎']
            },
            toolbox: {
                feature: {
                    saveAsImage: {}
                }
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            xAxis: [
                {
                    type: 'category',
                    boundaryGap: false,
                    data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
                }
            ],
            yAxis: [
                {
                    type: 'value'
                }
            ],
            series: [
                {
                    name: '邮件营销',
                    type: 'line',
                    stack: '总量',
                    areaStyle: {},
                    data: [120, 132, 101, 134, 90, 230, 210]
                },
                {
                    name: '联盟广告',
                    type: 'line',
                    areaStyle: {},
                    data: [220, 182, 191, 234, 290, 330, 310]
                },
                {
                    name: '视频广告',
                    type: 'line',
                    stack: '总量',
                    areaStyle: {},
                    data: [150, 232, 201, 154, 190, 330, 410]
                },
                {
                    name: '直接访问',
                    type: 'line',
                    stack: '总量',
                    areaStyle: {},
                    data: [320, 332, 301, 334, 390, 330, 320]
                },
                {
                    name: '搜索引擎',
                    type: 'line',
                    stack: '总量',
                    label: {
                        normal: {
                            show: true,
                            position: 'top'
                        }
                    },
                    areaStyle: {},
                    data: [820, 932, 901, 934, 1290, 1330, 1320]
                }
            ]
        };
        echartsRecords.setOption(optionRecords);


        /**
         * 玫瑰图表
         */
        var echartsPies = echarts.init(document.getElementById('echarts-pies'), 'walden');
        var optionPies = {
            title: {
                text: '用户来源-玫瑰图',
                left: 'center'
            },
            backgroundColor:"#fff",
            tooltip: {
                trigger: 'item',
                formatter: '{a} <br/>{b} : {c} ({d}%)'
            },
            legend: {
                orient: 'vertical',
                left: 'left',
                data: ['直接注册', '邀请助力']
            },
            series: [
                {
                    name: '注册来源',
                    type: 'pie',
                    radius: '55%',
                    center: ['50%', '60%'],
                    roseType: 'radius',
                    data: [
                        {value: "{{$ruleUser}}", name: '直接注册'},
                        {value: "{{$shareFreeUser}}", name: '邀请助力'},
                    ],
                    emphasis: {
                        itemStyle: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    }
                }
            ]
        };
        echartsPies.setOption(optionPies);



        // echarts 窗口缩放自适应
        window.onresize = function () {
            echartsRecords.resize();
        }

    });
</script>
@include('admin/_include/footer')